#include <boost/thread/tss.hpp> 
#include <boost/unordered_map.hpp>

#include "fast_stm.h"
#include "transaction.h"
#include "transaction_queue.h"

using namespace boost;

static thread_specific_ptr<transaction_t> g_transactions;

transaction_queue_t* g_transaction_queue = new transaction_queue_t();

void initialize()
{
}

void initialize_thread()
{
	transaction_t* t = g_transactions.get();
	if (t != NULL)
	{
		LOGE("initialize_thread t!=NULL");
		return;
	}
	g_transactions.reset(new transaction_t());
}

void finalize_thread()
{
	transaction_t* t = g_transactions.get();
	if (t == NULL)
	{
		LOGE("finalize_thread t==NULL");
		return;
	}
	delete t;
}

void finalize()
{

}

transaction_t* initialize_transaction()
{
	transaction_t* t = new transaction_t();
	g_transactions.reset(t);
	t->start();
	return t;
}
